﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace FAP.DataAccess
{
    public class DAL
    {
        #region websiteSelectAll
        public static SqlDataReader websiteSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "websiteSelectAllRows");
        }
        #endregion
        #region websiteSelectRow
        public static SqlDataReader websiteSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "websiteSelectRow", id);
        }
        #endregion
        #region websiteInsertRow
        public static void websiteInsertRow(string link, int trangthai, string tag, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "websiteInsertRow", link, trangthai, tag, isdeleted);
        }
        #endregion
        #region websiteUpdateRow
        public static void websiteUpdateRow(int id, string link, int trangthai, string tag, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "websiteUpdateRow", id, link, trangthai, tag, isdeleted);
        }
        #endregion
        #region websiteDeleteRow
        public static void websiteDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "websiteDeleteRow", id);
        }
        #endregion
        #region taikhoanSelectAll
        public static SqlDataReader taikhoanSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "taikhoanSelectAllRows");
        }
        #endregion
        #region taikhoanSelectRow
        public static SqlDataReader taikhoanSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "taikhoanSelectRow", id);
        }
        #endregion
        #region taikhoanSelectRow_CanUp
        public static SqlDataReader taikhoanSelectRow_CanUp(int idbaiviet)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "taikhoanSelectRow_CanUp", idbaiviet);
        }
        #endregion
        #region taikhoanSelectRowByForeignKey_websiteid
        public static SqlDataReader taikhoanSelectRowByForeignKey_websiteid(int websiteid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "taikhoanSelectRowByForeignKey_websiteid", websiteid);
        }
        #endregion
        #region taikhoanInsertRow
        public static void taikhoanInsertRow(string tendangnhap, string matkhau, string email, string cookie, DateTime ngayhethan, int websiteid, int trangthai, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "taikhoanInsertRow", tendangnhap, matkhau, email, cookie, ngayhethan, websiteid, trangthai, isdeleted);
        }
        #endregion
        #region taikhoanUpdateRow
        public static void taikhoanUpdateRow(int id, string tendangnhap, string matkhau, string email, string cookie, DateTime ngayhethan, int websiteid, int trangthai, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "taikhoanUpdateRow", id, tendangnhap, matkhau, email, cookie, ngayhethan, websiteid, trangthai, isdeleted);
        }
        #endregion
        #region taikhoanDeleteRow
        public static void taikhoanDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "taikhoanDeleteRow", id);
        }
        #endregion
        #region nghiepvuSelectAll
        public static SqlDataReader nghiepvuSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "nghiepvuSelectAllRows");
        }
        #endregion
        #region nghiepvuSelectRow
        public static SqlDataReader nghiepvuSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "nghiepvuSelectRow", id);
        }
        #endregion
        #region nghiepvuInsertRow
        public static void nghiepvuInsertRow(int id, string tennghiepvu, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "nghiepvuInsertRow", id, tennghiepvu, isdeleted);
        }
        #endregion
        #region nghiepvuUpdateRow
        public static void nghiepvuUpdateRow(int id, string tennghiepvu, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "nghiepvuUpdateRow", id, tennghiepvu, isdeleted);
        }
        #endregion
        #region nghiepvuDeleteRow
        public static void nghiepvuDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "nghiepvuDeleteRow", id);
        }
        #endregion
        #region fieldformatSelectAll
        public static SqlDataReader fieldformatSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "fieldformatSelectAllRows");
        }
        #endregion
        #region fieldformatSelectRow
        public static SqlDataReader fieldformatSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "fieldformatSelectRow", id);
        }
        #endregion
        #region fieldformatInsertRow
        public static void fieldformatInsertRow(string ten, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "fieldformatInsertRow", ten, isdeleted);
        }
        #endregion
        #region fieldformatUpdateRow
        public static void fieldformatUpdateRow(int id, string ten, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "fieldformatUpdateRow", id, ten, isdeleted);
        }
        #endregion
        #region fieldformatDeleteRow
        public static void fieldformatDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "fieldformatDeleteRow", id);
        }
        #endregion
        #region danhmucSelectAll
        public static SqlDataReader danhmucSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "danhmucSelectAllRows");
        }
        #endregion
        #region danhmucSelectRow
        public static SqlDataReader danhmucSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "danhmucSelectRow", id);
        }
        #endregion
        #region danhmucSelectRowByForeignKey_websiteid
        public static SqlDataReader danhmucSelectRowByForeignKey_websiteid(int websiteid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "danhmucSelectRowByForeignKey_websiteid", websiteid);
        }
        #endregion
        #region danhmucInsertRow
        public static void danhmucInsertRow(int id, string tendanhmuc, int websiteid, string topicid, string linkdanhmuc, string linkpost, string tag, int parentid, bool ispost, int trangthai, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "danhmucInsertRow", id, tendanhmuc, websiteid, topicid, linkdanhmuc, linkpost, tag, parentid, ispost, trangthai, isdeleted);
        }
        #endregion
        #region danhmucUpdateRow
        public static void danhmucUpdateRow(int id, string tendanhmuc, int websiteid, string topicid, string linkdanhmuc, string linkpost, string tag, int parentid, bool ispost, int trangthai, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "danhmucUpdateRow", id, tendanhmuc, websiteid, topicid, linkdanhmuc, linkpost, tag, parentid, ispost, trangthai, isdeleted);
        }
        #endregion
        #region danhmucDeleteRow
        public static void danhmucDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "danhmucDeleteRow", id);
        }
        #endregion
        #region chitietnghiepvuSelectAll
        public static SqlDataReader chitietnghiepvuSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietnghiepvuSelectAllRows");
        }
        #endregion
        #region chitietnghiepvuSelectRow
        public static SqlDataReader chitietnghiepvuSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietnghiepvuSelectRow", id);
        }
        #endregion
        #region chitietnghiepvuSelectRowByForeignKey_nghiepvuid
        public static SqlDataReader chitietnghiepvuSelectRowByForeignKey_nghiepvuid(int nghiepvuid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietnghiepvuSelectRowByForeignKey_nghiepvuid", nghiepvuid);
        }
        #endregion
        #region chitietnghiepvuSelectRowByForeignKey_websiteid
        public static SqlDataReader chitietnghiepvuSelectRowByForeignKey_websiteid(int websiteid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietnghiepvuSelectRowByForeignKey_websiteid", websiteid);
        }
        #endregion
        #region chitietnghiepvuSelectRowByForeignKey_nghiepvuid_websiteid
        public static SqlDataReader chitietnghiepvuSelectRowByForeignKey_nghiepvuid_websiteid(int nghiepvuid, int websiteid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietnghiepvuSelectRowByForeignKey_nghiepvuid_websiteid", nghiepvuid, websiteid);
        }
        #endregion
        #region chitietnghiepvuInsertRow
        public static void chitietnghiepvuInsertRow(int nghiepvuid, int websiteid, int trangthai, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "chitietnghiepvuInsertRow", nghiepvuid, websiteid, trangthai, isdeleted);
        }
        #endregion
        #region chitietnghiepvuUpdateRow
        public static void chitietnghiepvuUpdateRow(int id, int nghiepvuid, int websiteid, int trangthai, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "chitietnghiepvuUpdateRow", id, nghiepvuid, websiteid, trangthai, isdeleted);
        }
        #endregion
        #region chitietnghiepvuDeleteRow
        public static void chitietnghiepvuDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "chitietnghiepvuDeleteRow", id);
        }
        #endregion
        #region chitietbuocthuchienSelectAll
        public static SqlDataReader chitietbuocthuchienSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietbuocthuchienSelectAllRows");
        }
        #endregion
        #region chitietbuocthuchienSelectRow
        public static SqlDataReader chitietbuocthuchienSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietbuocthuchienSelectRow", id);
        }
        #endregion
        #region chitietbuocthuchienSelectRowByForeignKey_fieldformatid
        public static SqlDataReader chitietbuocthuchienSelectRowByForeignKey_fieldformatid(int fieldformatid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietbuocthuchienSelectRowByForeignKey_fieldformatid", fieldformatid);
        }
        #endregion
        #region chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien
        public static SqlDataReader chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien(int idbuocthuchien)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien", idbuocthuchien);
        }
        #endregion
        #region chitietbuocthuchienInsertRow
        public static void chitietbuocthuchienInsertRow(string tenfield, string kieudulieu, int fieldformatid, string dulieumacdinh, int idbuocthuchien, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "chitietbuocthuchienInsertRow", tenfield, kieudulieu, fieldformatid, dulieumacdinh, idbuocthuchien, isdeleted);
        }
        #endregion
        #region chitietbuocthuchienUpdateRow
        public static void chitietbuocthuchienUpdateRow(int id, string tenfield, string kieudulieu, int fieldformatid, string dulieumacdinh, int idbuocthuchien, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "chitietbuocthuchienUpdateRow", id, tenfield, kieudulieu, fieldformatid, dulieumacdinh, idbuocthuchien, isdeleted);
        }
        #endregion
        #region chitietbuocthuchienDeleteRow
        public static void chitietbuocthuchienDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "chitietbuocthuchienDeleteRow", id);
        }
        #endregion
        #region buocthuchienSelectAll
        public static SqlDataReader buocthuchienSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "buocthuchienSelectAllRows");
        }
        #endregion
        #region buocthuchienSelectRow
        public static SqlDataReader buocthuchienSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "buocthuchienSelectRow", id);
        }
        #endregion
        #region buocthuchienSelectRowByForeignKey_chitietnghiepvuid
        public static SqlDataReader buocthuchienSelectRowByForeignKey_chitietnghiepvuid(int chitietnghiepvuid)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "buocthuchienSelectRowByForeignKey_chitietnghiepvuid", chitietnghiepvuid);
        }
        #endregion
        #region buocthuchienInsertRow
        public static object buocthuchienInsertRow(int thutu, int trangthai, int chitietnghiepvuid, string link, string method, bool isdeleted)
        {
           return SqlHelper.ExecuteScalar(ConnectionString, "buocthuchienInsertRow", thutu, trangthai, chitietnghiepvuid, link, method, isdeleted);
        }
        #endregion
        #region buocthuchienUpdateRow
        public static void buocthuchienUpdateRow(int id, int thutu, int trangthai, int chitietnghiepvuid, string link, string method, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "buocthuchienUpdateRow", id, thutu, trangthai, chitietnghiepvuid, link, method, isdeleted);
        }
        #endregion
        #region buocthuchienDeleteRow
        public static void buocthuchienDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "buocthuchienDeleteRow", id);
        }
        #endregion
        #region baivietSelectAll
        public static SqlDataReader baivietSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "baivietSelectAllRows");
        }
        #endregion
        #region baivietSelectRow
        public static SqlDataReader baivietSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "baivietSelectRow", id);
        }
        #endregion
        #region baivietSelectRowByForeignKey_idtaikhoan
        public static SqlDataReader baivietSelectRowByForeignKey_idtaikhoan(int idtaikhoan)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "baivietSelectRowByForeignKey_idtaikhoan", idtaikhoan);
        }
        #endregion
        #region baivietSelectRowByForeignKey_websiteId
        public static SqlDataReader baivietSelectRowByForeignKey_websiteId(int websiteId)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "baivietSelectRowByForeignKey_websiteId", websiteId);
        }
        #endregion
        #region baivietSelectRowByForeignKey_idtaikhoan_websiteId
        public static SqlDataReader baivietSelectRowByForeignKey_idtaikhoan_websiteId(int idtaikhoan, int websiteId)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "baivietSelectRowByForeignKey_idtaikhoan_websiteId", idtaikhoan, websiteId);
        }
        #endregion
        #region baivietInsertRow
        public static void baivietInsertRow(int idtaikhoan, int websiteId, string tieude, string noidung, string link, DateTime ngaytao, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "baivietInsertRow", idtaikhoan, websiteId, tieude, noidung, link, ngaytao, isdeleted);
        }
        #endregion
        #region baivietUpdateRow
        public static void baivietUpdateRow(int id, int idtaikhoan, int websiteId, string tieude, string noidung, string link, DateTime ngaytao, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "baivietUpdateRow", id, idtaikhoan, websiteId, tieude, noidung, link, ngaytao, isdeleted);
        }
        #endregion
        #region baivietDeleteRow
        public static void baivietDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "baivietDeleteRow", id);
        }
        #endregion
        #region commentSelectAll
        public static SqlDataReader commentSelectAll()
        {
            return SqlHelper.ExecuteReader(ConnectionString, "commentSelectAllRows");
        }
        #endregion
        #region commentSelectRow
        public static SqlDataReader commentSelectRow(int id)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "commentSelectRow", id);
        }
        #endregion
        #region commentSelectRowByForeignKey_idtaikhoan
        public static SqlDataReader commentSelectRowByForeignKey_idtaikhoan(int idtaikhoan)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "commentSelectRowByForeignKey_idtaikhoan", idtaikhoan);
        }
        #endregion
        #region commentSelectRowByForeignKey_idbaiviet
        public static SqlDataReader commentSelectRowByForeignKey_idbaiviet(int idbaiviet)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "commentSelectRowByForeignKey_idbaiviet", idbaiviet);
        }
        #endregion
        #region commentSelectRowByForeignKey_idtaikhoan_idbaiviet
        public static SqlDataReader commentSelectRowByForeignKey_idtaikhoan_idbaiviet(int idtaikhoan, int idbaiviet)
        {
            return SqlHelper.ExecuteReader(ConnectionString, "commentSelectRowByForeignKey_idtaikhoan_idbaiviet", idtaikhoan, idbaiviet);
        }
        #endregion
        #region commentInsertRow
        public static void commentInsertRow(int idtaikhoan, int idbaiviet, string link, string nguoitao, string tieude, string noidung, DateTime ngaytao, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "commentInsertRow", idtaikhoan, idbaiviet, link, nguoitao, tieude, noidung, ngaytao, isdeleted);
        }
        #endregion
        #region commentUpdateRow
        public static void commentUpdateRow(int id, int idtaikhoan, int idbaiviet, string link, string nguoitao, string tieude, string noidung, DateTime ngaytao, bool isdeleted)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "commentUpdateRow", id, idtaikhoan, idbaiviet, link, nguoitao, tieude, noidung, ngaytao, isdeleted);
        }
        #endregion
        #region commentDeleteRow
        public static void commentDeleteRow(int id)
        {
            SqlHelper.ExecuteNonQuery(ConnectionString, "commentDeleteRow", id);
        }
        #endregion

        public static string ConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
        }
    }
}
